using IQIGame.Onigao.GamePlay;

namespace IQIGame.Onigao.Logic
{
    /// <summary>
    /// 设置关卡参数
    /// 参数：1:type(0全量，1增量) 2：key，3：value
    /// </summary>
    public class ExecChangeLevelParams : BaseServiceExecution
    {
        public override void Execute(LevelRegion region, LevelPlayer player)
        {
            var config = _config as ExecParamChangeLevelParams;

            int intType = config.type;
            if (intType > 1 || intType < 0)
            {
                PrintParamInvalidError();
                intType = 0;
            }
            ExecChangeValueType type = (ExecChangeValueType)intType;
            int key = config.key;
            int value = config.value;
            region.level.SetLevelParam(key, value, type);
        }
    }
}
